<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../src/css/reset.css" />
		<link rel="stylesheet" type="text/css" href="../../src/css/main.css" />
		<link rel="stylesheet" type="text/css" href="../../libs/leaflet/leaflet.css" />
		<script src="../../libs/leaflet/leaflet.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../libs/leaflet/leaflet.ChineseTmsProviders.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="map"></div>
		<script type="text/javascript"  id="my_script">
			let map = L.map('map', {
				center: [32.444721222054795, 119.4224873962402], // leaflet 所有坐标都是纬度在前,经度在后的
				zoom: 16
			})

			// 地图依赖于leaflet.ChineseTmsProviders.js  他提供4326坐标系的天地图,高德地图等
			let baseLayer = L.tileLayer.chinaProvider('TianDiTu.Normal.Map', {
				maxZoom: 18,
				minZoom: 10
			})
			map.addLayer(baseLayer)
			let labelLayer = L.tileLayer.chinaProvider('TianDiTu.Normal.Annotion', {
				maxZoom: 18,
				minZoom: 10
			})
			map.addLayer(labelLayer)

			let marker = L.marker([32.444721222054795, 119.4224873962402]).addTo(map)

			marker.bindTooltip('纯文本提示', {
				direction: 'top',
				offset: [0, 0],
			})

			var myIcon = L.icon({
				iconUrl: '../../src/images/point.png',
				iconSize: [19, 26],
				iconAnchor: [13, -4], //相对偏移的位置 把图片认为是一个正方形,点击的地方就是正方形的左上角
				popupAnchor: [], // 弹出窗口相对于图标锚点“打开”的点的坐标。
			});
			let marker2 = L.marker([32.443, 119.4224873962402], {
				icon: myIcon
			}).addTo(map)
			marker2.bindTooltip('<a href="https://www.baidu.com/" target="_blank">一直显示，可以点击的</a>', {
				permanent: true, //一直显示
				offset: [0, 0],
				interactive: true, // 这个值为true 时可以 点击这个tooltip
			})

			let polyline = L.polyline([
				[32.44421222054795, 119.4224873962402],
				[32.444721222054795, 119.4324873962402]
			], {
				color: '#E8542B'
			}).addTo(map)
			polyline.bindTooltip('跟着鼠标的', {
				offset: [0, 0],
				sticky: true //跟着鼠标
			})
		</script>
	</body>
</html>
